#[derive(Debug)]
enum Food {
    Pizza,
    Salad,
}

#[derive(Debug)]
enum PaymentMode {
    Bitcoin,
    Credit,
}

struct Order {
    count: u8,
    item: Food,
    payment: PaymentMode,
}

fn main() {
    let mut food_order = Order {
        count: 2,
        item: Food::Salad,
        payment: PaymentMode::Credit,
    };

    // 解构
    let Order { count, item, .. } = food_order;

    // 解构引用
    let Order { ref count, ref item, .. } = food_order;

    // 解构可变引用
    let Order { count, item, .. } = &mut food_order;
    println!("{count} - {item:?}");
}